﻿using CrawlerApp.Core.Entities;
using CrawlerApp.Core.Interfaces;
using CrawlerApp.Infrastructure.Services;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace CrawlerApp.Core.Services
{
    public class BookService : IBookService
    {
        private readonly IBookRepository repository;

        public BookService(IBookRepository repository)
        {
            this.repository = repository;
        }

        public async Task<IReadOnlyCollection<BookRank>> GetBookRanks(Expression<Func<BookRank,int>> order)
        {
            return await repository.GetBookRanksAsync(order);
        }
    }
}
